<template>
	<view>
		<view class="list">
			<view class="col" v-for="item in list" :key="item.id">
				<view class="item">
					<view class="upper">
						<view class="title ovh">
							订单号：{{item.order_no}}
						</view>
						<view :class="item.order_status">
							{{item.order_status_text}}
						</view>
					</view>
					<view class="container">
						<image :src="item.goods_image" mode="aspectFill"></image>
						<view class="content">
							<view class="title ovh2">
								{{item.goods_name}}
							</view>
							<view class="text">
								<view class="score">
									<image src="@/static/staff/jifen.png" mode=""></image> {{item.total}}
								</view>
								<view class="num">
									数量 {{item.goods_number}}
								</view>
							</view>
						</view>
					</view>
					<view class="bottom">
						<text> {{item.createtime}}</text>
						<text class="btn" @click="goodsDetail(item)"> 再次兑换</text>
					</view>
				</view>
			</view>
		</view>
		<uni-load-more :status="status"></uni-load-more>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				page: 1,
				status: "no-more",
				score: '',
				statusBarHeight: null,
				keywords: ''
			}
		},
		onLoad() {
			this.init()
		},
		onPullDownRefresh() {
			this.init()
		},
		onReachBottom() {
			this.page++
			this.getList()
		},
		methods: {
			init() {
				this.list = []
				this.page = 1
				this.getList()
			},
			getList() {
				this.status = "loading"
				this.$post("/user/order_list", {
					page: this.page,
				}).then(res => {
					this.status = "no-more"
					uni.stopPullDownRefresh()
					this.list = this.list.concat(res.data.data)
				})
			},
			goodsDetail(item) {
				console.log(item)
				uni.navigateTo({
					url: "/pages/staff/index/detail?goods_no=" + item.goods_no
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f8f8f8;
		padding: 30rpx;
		height: 100vh;
		box-sizing: border-box;

	}

	.list {
		.col {
			padding: 10rpx 0;

			.item {
				background-color: #fff;
				border-radius: 16rpx;

				.upper {
					padding: 20rpx 30rpx;
					font-size: 26rpx;
					display: flex;
					align-items: center;
					justify-content: space-between;

					.title {
						width: calc(100% - 140rpx);
					}

					.complete {
						max-width: 120rpx;
						color: $main-color;
					}

					.pending {
						max-width: 120rpx;
						color: $main-red;
					}
				}

				.container {
					padding: 20rpx 30rpx;
					border-top: 1rpx solid #eee;
					border-bottom: 1rpx solid #eee;
					display: flex;
					align-items: center;

					image {
						width: 170rpx;
						height: 148rpx;
						background: #FFFFFF;
						border-radius: 20rpx;
					}

					.content {
						width: calc(100% - 170rpx);
						padding-left: 26rpx;

						.title {
							font-size: 30rpx;
							margin-bottom: 20rpx;
						}

						.text {
							display: flex;
							align-items: center;
							justify-content: space-between;

							.score {
								display: flex;
								align-items: center;
								font-size: 26rpx;
								color: #FF5B5B;

								image {
									width: 24rpx;
									height: 24rpx;
									margin-right: 10rpx;
								}
							}

							.num {
								font-size: 24rpx;
								color: #7C7C7C;
							}
						}
					}
				}

				.bottom {
					display: flex;
					align-items: center;
					justify-content: space-between;
					font-size: 24rpx;
					color: #7C7C7C;
					padding: 20rpx 30rpx;

					.btn {
						color: #fff;
						background-color: $main-color;
						font-size: 28rpx;
						width: 180rpx;
						height: 60rpx;
						border-radius: 6rpx;
						text-align: center;
						line-height: 60rpx;
					}
				}
			}
		}

	}
</style>